<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="/images/favicon.ico"  type="image/x-icon">

    <title>判断题创编</title>

    <link rel="stylesheet" type="text/css" href="/js/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/style-responsive.css" rel="stylesheet">


    <!--icheck-->
    <link th:href="@{/js/iCheck/skins/minimal/minimal.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/minimal/red.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/minimal/green.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/minimal/blue.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/minimal/yellow.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/minimal/purple.css}" rel="stylesheet">

    <link th:href="@{/js/iCheck/skins/square/square.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/square/red.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/square/green.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/square/blue.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/square/yellow.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/square/purple.css}" rel="stylesheet">

    <link th:href="@{/js/iCheck/skins/flat/grey.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/flat/red.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/flat/green.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/flat/blue.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/flat/yellow.css}" rel="stylesheet">
    <link th:href="@{/js/iCheck/skins/flat/purple.css}" rel="stylesheet">


    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="/js/html5shiv.js"></script>
    <script src="/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header">

<section>

    <!--左侧开始-->
    <div th:replace="~{admin/commons/common :: commonleft}"></div>
    <!--左侧结束-->

    <!-- main content start-->
    <div class="main-content" >

        <!--头部开始-->
        <div th:replace="~{admin/commons/common :: commonheader}"></div>
        <!--头部结束-->

        <!--当前位置介绍开始-->
        <div class="page-heading">
            <h3>
                判断题创编
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">题库管理</a>
                </li>
                <li class="active"> 判断题创建 </li>
            </ul>
        </div>
        <!-- 当前位置介绍结束-->

        <div class="wrapper">
            <div class="mail-box">

                <section class="mail-box-info">
                    <header class="header">
                        <div class="btn-toolbar">
                            <h4 class="pull-left">
                                判断题创建中......
                            </h4>
                        </div>

                    </header>

                    <section class="mail-list">
                        <div class="compose-mail">
                            <form role="form-horizontal" th:action="@{/admin/judgmentals}" method="post">
                                <div class="form-group">
                                    <label for="to" class="">To:</label>
                                    <input type="text" tabindex="1" id="to" name="to" class="form-control" required>
                                    <!--                                    <div class="compose-options">-->
                                    <!--                                        <a onclick="$(this).hide(); $('#cc').parent().removeClass('hidden'); $('#cc').focus();" href="javascript:;">Cc</a>-->
                                    <!--                                        <a onclick="$(this).hide(); $('#bcc').parent().removeClass('hidden'); $('#bcc').focus();" href="javascript:;">Bcc</a>-->
                                    <!--                                    </div>-->
                                </div>

                                <!--                                <div class="form-group hidden">-->
                                <!--                                    <label for="cc" class="0">Cc:</label>-->
                                <!--                                    <input type="text" tabindex="2" id="cc" class="form-control">-->
                                <!--                                </div>-->

                                <!--                                <div class="form-group hidden">-->
                                <!--                                    <label for="bcc" class="">Bcc:</label>-->
                                <!--                                    <input type="text" tabindex="2" id="bcc" class="form-control">-->
                                <!--                                </div>-->

                                <div class="form-group">
                                    <label for="subject" class="">Subject:</label>
                                    <input type="text" name="subject" tabindex="1" id="subject" class="form-control">
                                </div>

                                <!--onclick函数，当管理员点击题干表单时题干表单设置不可见，显示富文本编辑器，-->
                                <div class="form-group">
                                    <label for="textarea" class="">题干:</label>
                                    <input type="text" tabindex="1" name="content" id="subject2" class="form-control"
                                           onclick="$(this).parent().addClass('hidden');//当前表单设置不可见
                                           $('#textarea').parent().removeClass('hidden');//富文本编辑器设置可见
                                           $('#textarea-button').removeClass('hidden');//富文本编辑器按钮设置可见
                                           $('#textarea').focus();"
                                           required
                                    >
                                </div>
                                &nbsp;
                                <!--富文本编辑器开始，包括按钮-->
                                <div class="compose-editor hidden">
                                    <textarea id="textarea" class="wysihtml5 form-control" rows="5" th:text="请在此输入题干"></textarea>
                                </div>
                                <div class="compose-btn hidden" id="textarea-button">
                                    <button type="button" class="btn btn-primary btn-sm"
                                            onclick="$('#subject2').attr('value',$('#textarea').val());//设置题干的文本内容为富文本编辑器的内容
                                            $('#textarea').parent().addClass('hidden');//设置文本编辑器不可见，
                                            $('#textarea-button').addClass('hidden');//设置按钮不可见，设置题干可见
                                            $('#subject2').parent().removeClass('hidden')"
                                    ><i class="fa fa-check"></i> 确定</button>
                                    <button type="button" onclick="quit()" class="btn btn-sm btn-default"><i class="fa fa-times"></i> 取消</button>
                                </div>
                                <!--富文本编辑器结束-->
                                <div id="p">
                                    <div class="form-group">
                                        <label for="subject" class="a">√</label>
                                        <input type="text" tabindex="1" id="√" class="form-control" name="√" required>
                                    </div>

                                    <div class="form-group">
                                        <label for="subject" class="a">×</label>
                                        <input type="text" tabindex="1" id="×" class="form-control" name="×" required>
                                    </div>
                                </div>

                                &nbsp;
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">答案</label>

                                    <div class="col-sm-9 icheck ">

                                        <div class="flat-grey ">
                                            <div class="radio " >
                                                <input tabindex="3" type="radio"  name="correct" id="r_1" value="√">
                                                √
                                            </div>
                                        </div>
                                        <div class="flat-red ">
                                            <div class="radio ">
                                                <input tabindex="3" type="radio" name="correct" id="r_2" value="×">
                                                ×
                                            </div>
                                        </div>

                                    </div>
                                </div>

                                <!--                                <div class="form-group">-->
                                <!--                                    <label for="bcc" class="">答案</label>-->
                                <!--                                    <input type="text" tabindex="2" id="Key" class="form-control">-->
                                <!--                                </div>-->

                                <div class="form-group">
                                    <label  class="">解析</label>
                                    <input type="text" name="analysis" tabindex="2" id="Answer" class="form-control" required>
                                </div>
                                <!--                                分数开始-->
                                <div class="form-group">
                                    <label  class="">分数</label>
                                    <div id="spinner4">
                                        <div class="input-group" style="width:150px;">
                                            <div class="spinner-buttons input-group-btn">
                                                <button type="button" class="btn spinner-up btn-primary">
                                                    <i class="fa fa-plus"></i>
                                                </button>
                                            </div>
                                            <input type="text" name="score" id="score" class="spinner-input form-control" maxlength="3" style="text-align: center;">
                                            <div class="spinner-buttons input-group-btn">
                                                <button type="button" class="btn spinner-down btn-warning">
                                                    <i class="fa fa-minus"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--                                分数结束-->
                                <!--                                难度选择开始-->
                                <div class="form-group">
                                    <label  class="">难度</label>
                                    <div class="btn-group btn-group-justified" style="width: 90%">
                                        <a class="btn btn-success" type="button" name="b1" onclick="cd1()" id="b1" value="1" style="width:20%">简单</a>
                                        <a class="btn btn-info" type="button" name="b2" onclick="cd2()"  id="b2" value="2" style="width:29%" >中等</a>
                                        <a class="btn btn-danger" type="button" name="b3" onclick="cd3()"  id="b3" value="3" style="width:39%">困难</a>
                                        <a class="btn btn-default hidden" type="button" name="b32" onclick="cd4()"  id="b4" >重置</a>
                                        <input type="text" name="difficult" style="display: none" id="nd" value='1' >
                                    </div>
                                </div>
                                &nbsp;
                                <!--                                难度选择结束-->
                                <!--                                充当换行-->
                                <div class="form-group " style="display: none"></div>

                                <div class="compose-btn1">
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-check"></i> 完成</button>
                                    <button type="button" onclick="reSetQuestion()" class="btn btn-sm btn-warning"><i class="fa fa-rotate-right"></i> 重置</button>
                                </div>

                            </form>

                            <!--提示开始-->
                            <!--选项过多弹出框开始-->
                            <div class="col-md-12 ">
                                <a href="#myModal1" data-toggle="modal" class="btn btn-warning hidden" id="tip1">
                                    提示按钮
                                </a>
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal1" class="modal fade" style="display: none;">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="background:#bb1f1f">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">提示</h4>
                                            </div>
                                            <div class="modal-body">
                                                最多十个选项
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--选项过多弹出框开始-->
                            <!--选项过少弹出框开始-->
                            <div class="col-md-12 ">
                                <a href="#myModal2" data-toggle="modal" class="btn btn-warning hidden" id="tip2">
                                    提示按钮
                                </a>
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal2" class="modal fade" style="display: none;">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="background:#F4C160">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">提示</h4>
                                            </div>
                                            <div class="modal-body">
                                                最少三个选项
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--弹出框结束-->
                            <!--提示结束-->
                        </div>
                    </section>
                </section>
            </div>

        </div>
        <!--footer section start-->
        <footer>
            2022 &copy;平顶山学院软件应用双创实验室提供技术支持
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<div th:replace="~{admin/commons/common :: commonupdatePwd}"></div>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="/js/jquery-1.10.2.min.js"></script>
<script src="/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="/js/jquery-migrate-1.2.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/modernizr.min.js"></script>
<script src="/js/jquery.nicescroll.js"></script>

<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script>

<!--spinner-->
<script type="text/javascript" src="/js/fuelux/js/spinner.min.js"></script>
<script src="/js/spinner-init.js"></script>

<script type="text/javascript" src="/js/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
<script type="text/javascript" src="/js/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
<!--icheck -->
<script src="/js/iCheck/jquery.icheck.js"></script>
<script src="/js/icheck-init.js"></script>

<!--common scripts for all pages-->
<script src="/js/scripts.js"></script>

<script>
    document.getElementById("judgmental").className="active";
    document.getElementById("menu4").className="menu-list nav-active";
    //点击取消触发
    function quit(){
        $('#textarea').parent().addClass('hidden');//设置文本编辑器不可见，
        $('#textarea-button').addClass('hidden');//设置按钮不可见，设置题干可见
        $('#subject2').parent().removeClass('hidden')
    }


    //对点击按钮的操作
    function cd1() {
        $('#nd').val(1)
        $('#b2').addClass('hidden')
        $('#b3').addClass('hidden')
        $(this).attr("name",1)
        $('#b4').css("width","68%").removeClass('hidden')
        // $('#b4').removeClass('hidden')
    }
    function cd2() {
        $('#nd').val(2)
        $('#b1').addClass('hidden')
        $('#b3').addClass('hidden')
        $(this).attr("name",2)
        $('#b4').css("width","59%").removeClass('hidden')
    }
    function cd3() {
        $("#nd").attr("value",'3')
        $('#b1').addClass('hidden')
        $('#b2').addClass('hidden')
        $(this).attr("name",3)
        $('#b4').css("width","48%").removeClass('hidden')
    }
    function cd4() {
        $('#nd').val(3)
        $('#b1').removeClass('hidden')
        $('#b2').removeClass('hidden')
        $('#b3').removeClass('hidden')
        $('#b4').addClass('hidden')
    }
    function reSetQuestion() {
        //移除选定状态
        var arrR =['A','B','C','D','E','F','G','H','I','J']
        for(var i=0; i<arrR.length; i++){
            if(($("#r_"+arrR[i]+"").parent())!=null){
                $("#r_"+arrR[i]+"").parent().removeClass('checked')
            }

        }
        //将默认文本框的值设置为空
        $('#to').attr('value',null)
        $('#subject').attr('value',null)
        $('#subject2').attr('value',null)
        $('#Answer').attr('value',null)
        $('#A').attr('value',null)
        $('#B').attr('value',null)
        $('#C').attr('value',null)
        $('#D').attr('value',null)
        $('#score').attr('value',0)
        cd4()
    }


    // 修改密码
    $("#pwd_btn").click(function() {
        $("#pwd_btn").blur();
        if (confirm("是否确定修改?")){
            var submit = true;
            var oldPwd = $("#oldPwd").val(); //原始密码
            var newPwd = $("#newPwd").val(); //新密码1
            var newPwd2 = $("#newPwd2").val(); //新密码2

            if ((oldPwd && newPwd && newPwd2) == '') {
                $("#tip").html("密码不能为空");
                $("#tip").show();
                submit = false;
            }
            if(submit){
                $.ajax({
                    type:"post",
                    url:"/admin/updatePwd",
                    data: JSON.stringify({
                        oldPwd : oldPwd,
                        newPwd : newPwd,
                        newPwd2 : newPwd2
                    }),
                    contentType: "application/json;charset=utf-8",
                    //定义回调响应的数据格式为JSON字符串，该属性可以省略
                    dataType: "json",
                    success:function (data){
                        if(data.code == 200 ){
                            $("#tip").hide();
                            $("#pwd_form").submit();
                            alert("修改成功，请重新登录!")
                            window.location.href = "/user/logout"
                        }else if(data.code != 200){
                            $("#tip").html(data.info);
                            $("#tip").show();
                        }
                    }
                });
            }
        }
    });

    jQuery(document).ready(function(){
        $('.wysihtml5').wysihtml5();
    });

</script>

</body>
</html>
